<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="css/style1.css" />
		<style type="text/css">
			.mui-table-view:after {
				height: 0;
			}
			
			.mui-table-view:before {
				height: 0;
			}
			
			.mui-table-view-cell:not(:nth-child(6)):after {
				height: 1px;
			}
			
			.m-icon-bluev {
				display: inline-block;
				width: 16px;
				height: 16px;
				background-color: #222222;
				position: absolute;
				left: 18%;
				bottom: 5%;
				border-radius:25px;
			}
			
			.imgbig-peopl {
				position: absolute;
				left: 7%;
				top: 24%;
			}
			
			li:first-child {
				height: 86px;
				padding: 0;
			}
			
			li:first-child dd {
				padding-top: 1%;
				padding-left: 13%;
			}
			
			.positiabsou {
				display: inline-block;
				position: absolute;
				right: 15%;
				top: 27%;
			}
			
			.touxiang:before {
				width: 24px;
				height: 40px;
				position: absolute;
				bottom: 0;
				left: 30%;
				background: url('images/titleimg.png') no-repeat bottom right /13px 43px;
				content: '';
				-webkit-transform: scaleY(.5);
				transform: scaleY(.5);
			}
		</style>
	</head>

	<body>
		<!--固定栏，前置-->
		

		<div class="">
			<ul class="mui-table-view" id='persondetail'>
				<li class="mui-table-view-cell persontop" id="loggedin">
					<a class="mui-navigate-right" onclick="tranDetail()">
						<dl>
							<dt class="imgdt">
			                		<img src="images/header.png" alt="" id="headerPic" class="imgbig-peopl mui-pull-left"/>
			                		<i class="m-icon-bluev white-big">V</i>
			                	</dt>
							<dd class="blacker-big" id='nickname'>黑皮书</dd>
							<dd class="grey-smallest">已认证</dd>
						</dl>
					</a>
				</li>
				<li class="mui-table-view-cell persontop" style="display: none;" id="nologin">
					<a class="mui-navigate-right" onclick="toLogin()">
						<dl>
							<dt class="imgdt">
			                		<img src="images/header.png" alt="" class="imgbig-peopl mui-pull-left"/>
			                	</dt>
							<dd class="blacker-big" id='nickname'>未登录</dd>
						</dl>
					</a>
				</li>
				<li class="mui-table-view-cell">
					<a>
						<p class="grey-mid" id="description">“把每件事当作一个挑战，把自己活成一个牛逼”</p>
					</a>
				</li><li class="mui-table-view-cell">
					<a class="mui-navigate-right" onclick="topagej('listpubno')">
						<p class="blacker-big">待发布的榜单</p>
						<p><span id='listnum3' class="grey-mid positiabsou mui-pull-right">0</span></p>
					</a>
				</li>
				<li class="mui-table-view-cell">
					<a class="mui-navigate-right" onclick="topagej('listpub')">
						<p class="blacker-big">我发布的榜单</p>
						<p><span id='listnum1' class="grey-mid positiabsou mui-pull-right">0</span></p>
					</a>
				</li>
				<li class="mui-table-view-cell">
					<a class="mui-navigate-right" onclick="topagej('myfollow')">
						<p class="blacker-big">我关注的榜单</p>
						<p><span id='listnum2' class="grey-mid positiabsou mui-pull-right">0</span></p>
					</a>
				</li>
				<li class="mui-table-view-cell">
					<a class="mui-navigate-right" href="aboutdetail.html">
						关于黑皮书
					</a>
				</li>
				<li class="mui-table-view-cell">
					<a class="mui-navigate-right" onclick="shareHref()">
						分享APP
					</a>
				</li>
			</ul>
			<input type="hidden" id="uid" />
		</div>

		<div id="output" style="display: none;">
			<!--Share模块管理客户端的社交分享功能，提供调用终端社交软件的分享能力。通过plus.share可获取社交分享管理对象。-->
		</div>
		<div style="display: none;">
			<textarea id="sharecontent" rows="3">我正在使用黑皮书榜单应用，赶紧跟我一起来体验！</textarea>
			<input id="sharehref" class="sharehref" type="url" value="http://www.dcloud.io/" placeholder="请输入要分享的链接地址" />
			<input id="sharehrefTitle" class="sharehref" type="text" value="牛逼的黑皮书榜单" placeholder="请输入要分享的链接标题" />
			<input id="sharehrefDes" class="sharehref" type="text" value="黑皮书榜单应用，您的投资风向标" placeholder="请输入要分享的链接描述" />

		</div>
		<script src="js/mui.min.js"></script>
		<script src="js/jquery-2.1.3.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/setfontsize.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/common.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/config.js"></script>
		<script type="text/javascript">
			mui.init();
			getuinfo();
			function getuinfo() {
				var uid = localStorage.getItem("uid");
				mui.ajax(userurl + '/api/iuser/info/uinfo', {
					data: {
						uid: uid
					},
					dataType: 'json', //服务器返回json格式数据
					type: 'POST', //HTTP请求类型
					success: function(data) {
						if(data.code == -1) {
							$("#nologin").show();
							$("#loggedin").hide();
							/*toLogin();
							location.href="reg.html";*/
						} else {
							//$('#persondetail').html('');
							if(data.code == 1) {
								var user = data.data.user;
								$("#nickname").html(user.nickname + "/" + user.mobile);
								$("#listnum1").html(user.myHlistCount);
								$("#listnum2").html(user.collectCount);
								$("#description").html(user.description);
								var headerPic = "http://106.75.101.210"+user.headerPic;
								console.log(headerPic);
								$("#headerPic").attr("src",headerPic)

								localStorage.setItem("nickname", user.nickname);
								localStorage.setItem("mobile", user.mobile);
								localStorage.setItem("description", user.description);
								localStorage.setItem("headerPic", headerPic);
							} else {
								alert(5)
							}
						}
					},
					error: function(xhr, type, errorThrown) {
						//异常处理；
						console.log(type);
					}
				});
			}

			function tranDetail() {
				if(uid == null || uid == "") {
					toLogin();
				}
				mui.openWindow({
					url: 'persondetail.html',
					id: 'persondetail'
				});
			}

			var shares = null;
			// H5 plus事件处理
			function plusReady() {
				updateSerivces();
			}
			if(window.plus) {
				plusReady();
			} else {
				document.addEventListener('plusready', plusReady, false);
			}
			/**
			 * 更新分享服务
			 */
			function updateSerivces() {
				plus.share.getServices(function(s) {
					shares = {};
					for(var i in s) {
						var t = s[i];
						shares[t.id] = t;
					}
				}, function(e) {
					outSet('获取分享服务列表失败：' + e.message);
				});
			}
			// 通过系统组件分享 
			function shareSystem() {
				plus.share.sendWithSystem({
					content: '分享内容',
					href: 'http://www.dcloud.io/'
				}, function() {
					console.log('分享成功');
				}, function(e) {
					console.log('分享失败：' + JSON.stringify(e));
				});
			}
			// 分析链接
			function shareHref() {
				var shareBts = [];
				// 更新分享列表
				var ss = shares['weixin'];
				ss && ss.nativeClient && (shareBts.push({
						title: '微信朋友圈',
						s: ss,
						x: 'WXSceneTimeline'
					}),
					shareBts.push({
						title: '微信好友',
						s: ss,
						x: 'WXSceneSession'
					}));
				ss = shares['qq'];
				ss && ss.nativeClient && shareBts.push({
					title: 'QQ',
					s: ss
				});
				// 弹出分享列表
				shareBts.length > 0 ? plus.nativeUI.actionSheet({
					title: '分享链接',
					cancel: '取消',
					buttons: shareBts
				}, function(e) {
					(e.index > 0) && shareAction(shareBts[e.index - 1], true);
				}) : plus.nativeUI.alert('当前环境无法支持分享链接操作!');
			}

			/**
			 * 分享操作
			 * @param {JSON} sb 分享操作对象s.s为分享通道对象(plus.share.ShareService)
			 * @param {Boolean} bh 是否分享链接
			 */
			function shareAction(sb, bh) {
				outSet('分享操作：');
				if(!sb || !sb.s) {
					outLine('无效的分享服务！');
					return;
				}
				var msg = {
					content: sharecontent.value,
					extra: {
						scene: sb.x
					}
				};
				if(bh) {
					msg.href = sharehref.value;
					if(sharehrefTitle && sharehrefTitle.value != '') {
						msg.title = sharehrefTitle.value;
					}
					if(sharehrefDes && sharehrefDes.value != '') {
						msg.content = sharehrefDes.value;
					}
					msg.thumbs = ['images/smlogo.jpg'];
					msg.pictures = ['images/smlogo.jpg'];
				} else {
					if(pic && pic.realUrl) {
						msg.pictures = [pic.realUrl];
					}
				}
				// 发送分享
				if(sb.s.authenticated) {
					outLine('---已授权---');
					shareMessage(msg, sb.s);
				} else {
					outLine('---未授权---');
					sb.s.authorize(function() {
						shareMessage(msg, sb.s);
					}, function(e) {
						outLine('认证授权失败：' + e.code + ' - ' + e.message);
					});
				}
			}
			/**
			 * 发送分享消息
			 * @param {JSON} msg
			 * @param {plus.share.ShareService} s
			 */
			function shareMessage(msg, s) {
				outLine(JSON.stringify(msg));
				s.send(msg, function() {
					outLine('分享到"' + s.description + '"成功！');
				}, function(e) {
					outLine('分享到"' + s.description + '"失败: ' + JSON.stringify(e));
				});
			}
		</script>
	</body>

</html>